function AllReady() {
    var mstform = Ext.getCmp('AdvanceProject');
    var user_bdmc = mstform.queryById("user_bdmc");
    var user_sflhttb = mstform.queryById("user_sflhttb");
    var user_yelb = mstform.queryById("user_yelb");
    mstform.getItem('PhidCountry').setValue('1')
    BatchBindCombox([mstform.getItem('PhidCountry')])

    if(otype != 'view'){
        getTraceProjectInfo()
    }

    if (mstform.getItem('user_sflhttb').getValue() == '01') {
        mstform.getItem('user_lhtqtr').userSetMustInput(true);
        mstform.getItem('user_lhtcyf').userSetMustInput(true);
        mstform.getItem('user_lhtqtr').setVisible(true);
        mstform.getItem('user_lhtcyf').setVisible(true);
    } else {
        mstform.getItem('user_lhtqtr').userSetMustInput(false);
        mstform.getItem('user_lhtcyf').userSetMustInput(false);
        mstform.getItem('user_lhtcyf').setVisible(false);
        mstform.getItem('user_lhtqtr').setVisible(false);
    }
    mstform.getItem('PhidPctype').userSetMustInput(false);

    mstform.getItem('user_sccyllb').on('beforetriggerclick', function (eOp, ignoreBeforeEvent) {
        var pc = mstform.getItem('user_yelb').getValue();
        var pc2 = mstform.getItem('user_yelb').getRawValue();
        console.log(pc2);
        
        if (Ext.isEmpty(pc)) {
            Ext.Msg.alert('提示', '请先选择业务类别！');
            mstform.getItem('user_yelb').focus();
            return false;
        } else {
            mstform.getItem('user_sccyllb').setOutFilter({
                c_descript: pc2 //phid_pc 字段是通用帮助中的字段
            });
        }
    });
    mstform.getItem('user_hylb').on('beforetriggerclick', function (eOp, ignoreBeforeEvent) {
        var pc = mstform.getItem('user_sccyllb').getValue();
        var pc2 = mstform.getItem('user_sccyllb').getRawValue();
        console.log(pc2);
        
        if (Ext.isEmpty(pc)) {
            Ext.Msg.alert('提示', '请先选择市场产业链类别！');
            mstform.getItem('user_sccyllb').focus();
            return false;
        } else {
            mstform.getItem('user_hylb').setOutFilter({
                c_descript: pc2 //phid_pc 字段是通用帮助中的字段
            });
        }
    });
    user_bdmc.addListener("helpselected", function () {
        let u_bdmc = mstform.getItem('user_bdmc').getValue()
        getTraceProjectInfo()
        execServer(
            "searchXmxx",
            { u_bdmc: u_bdmc },
            function (res) {
                if (res.count > 0) {
                    var obj = JSON.parse(res.data);
                    console.log(obj);
                    mstform.getItem('ProjectName').setValue(obj[0].extendObjects.u_xmbmc)
                    mstform.getItem('user_yzdw').setValue(obj[0].extendObjects.u_yzdw)
                    mstform.getItem('user_scqy').setValue(obj[0].extendObjects.u_scqy)
                    BatchBindCombox([mstform.getItem('user_scqy')])
                    mstform.getItem('user_yelb').setValue(obj[0].extendObjects.u_ywlb)
                    BatchBindCombox([mstform.getItem('user_yelb')])
                    mstform.getItem('user_sccyllb').setValue(obj[0].extendObjects.u_sccyllb)
                    BatchBindCombox([mstform.getItem('user_sccyllb')])
                    mstform.getItem('user_hylb').setValue(obj[0].extendObjects.u_hylb)
                    BatchBindCombox([mstform.getItem('user_hylb')])
                    mstform.getItem('user_ejhylb').setValue(obj[0].extendObjects.u_ejhylb)
                    BatchBindCombox([mstform.getItem('user_ejhylb')])
                    mstform.getItem('user_scfw').setValue(obj[0].extendObjects.u_scfw)
                    BatchBindCombox([mstform.getItem('user_scfw')])
                    mstform.getItem('user_xmms').setValue(obj[0].extendObjects.u_xmms)
                    BatchBindCombox([mstform.getItem('user_xmms')])
                    // mstform.getItem('PhidTender').setValue(obj[0].extendObjects.u_yzdw)
                    // BatchBindCombox([mstform.getItem('PhidTender')])
                    mstform.getItem('user_yzdwssjt').setValue(obj[0].extendObjects.u_yzdwssjt)
                    BatchBindCombox([mstform.getItem('user_yzdwssjt')])
                    mstform.getItem('user_gzjb').setValue(obj[0].extendObjects.u_gzjb)
                    BatchBindCombox([mstform.getItem('user_gzjb')])
                    mstform.getItem('user_tbdw').setValue(obj[0].extendObjects.phid_org)
                    BatchBindCombox([mstform.getItem('user_tbdw')])
                    mstform.getItem('PhidTenPsn').setValue(obj[0].extendObjects.u_gzfzr)
                    BatchBindCombox([mstform.getItem('PhidTenPsn')])
                    mstform.getItem('user_tbfzrlxfs').setValue(obj[0].extendObjects.u_gzfzrlxfs)
                    mstform.getItem('GSituation').setValue(obj[0].extendObjects.u_xmjk)
                    mstform.getItem('PhidProvince').setValue(obj[0].extendObjects.u_xmszd)
                    BatchBindCombox([mstform.getItem('PhidProvince')])
                    mstform.getItem('PhidCity').setValue(obj[0].extendObjects.u_xmszs)
                    BatchBindCombox([mstform.getItem('PhidCity')])
                    mstform.getItem('PhidRegion').setValue(obj[0].extendObjects.u_xmszx)
                    BatchBindCombox([mstform.getItem('PhidRegion')])
                    mstform.getItem("BillNo").setValue(obj[0].extendObjects.bill_no)
                    // mstform.getItem('ProjectAddress').setValue(obj[0].extendObjects.u_scfw)
                    // BatchBindCombox([mstform.getItem('ProjectAddress')])
                    // PhidChkpsn.setValue(obj[0].extendObjects.manapsn)
                }
            }
        );
    });
    mstform.getItem('user_hylb').addListener("change", function () {
        let user_hylb = mstform.getItem('user_hylb').getValue()
        console.log(user_hylb);
        if (user_hylb == 6870000000000089) {
            mstform.getItem('user_ejhylb').userSetMustInput(true);
            mstform.getItem('user_ejhylb').setVisible(true);
        } else {
            mstform.getItem('user_ejhylb').userSetMustInput(false);
            mstform.getItem('user_ejhylb').setVisible(false);
        }

    });
    user_sflhttb.addListener("change", function () {
        let user_sflhttb = mstform.getItem('user_sflhttb').getValue()
        console.log(user_sflhttb);
        if (user_sflhttb == '01') {
            mstform.getItem('user_lhtqtr').userSetMustInput(true);
            mstform.getItem('user_lhtcyf').userSetMustInput(true);
            mstform.getItem('user_lhtqtr').setVisible(true);
            mstform.getItem('user_lhtcyf').setVisible(true);
        } else {
            mstform.getItem('user_lhtqtr').userSetMustInput(false);
            mstform.getItem('user_lhtcyf').userSetMustInput(false);
            mstform.getItem('user_lhtcyf').setVisible(false);
            mstform.getItem('user_lhtqtr').setVisible(false);
        }
    });
    user_yelb.addListener("change", function () {
        let user_yelb = mstform.getItem('user_yelb').getValue()
        console.log(user_yelb);
        if (user_yelb == '6870000000000112') {
            mstform.getItem("user_sccyllb").setValue(6870000000000085)
            BatchBindCombox([mstform.getItem('user_sccyllb')])
            mstform.getItem('user_hylb').userSetMustInput(false);
            mstform.getItem('user_hylb').setVisible(false);
        } else {
            mstform.getItem('user_hylb').userSetMustInput(true);
            mstform.getItem('user_hylb').setVisible(true);
        }
    });

    // 获取项目跟踪信息
    function getTraceProjectInfo(){
        const phid = mstform.getItem("user_bdmc").getValue()
        console.log(`获取中`,phid);
        if(!phid) return
        execServer("getTraceProjectInfo",{phid},(res)=>{
            if(res.count == 0) return 
            const datas = JSON.parse(res.data)[0].extendObjects
            // 项目所在地设置
            console.log(`跟踪项目信息`,datas);
            const title = `${datas.sheng_name||''}-${datas.city_name||''}-${datas.qvxian_name || ''}`
            mstform.getItem("user_xmszd").setValue(title)
        })
    }

}




